

# getSocketEvents

<div class="api-docs__separator" data-reactroot="">

---

</div><div class="api-docs__import" data-reactroot="">

```ts
import { getSocketEvents } from "@hyper-fetch/sockets"
```

</div><div class="api-docs__section">

## Description

</div><div class="api-docs__description"><span class="api-docs__do-not-parse">



</span></div><p class="api-docs__definition">

Defined in [socket/socket.events.ts:21](https://github.com/BetterTyped/hyper-fetch/blob/cc329b91/packages/sockets/src/socket/socket.events.ts#L21)

</p><div class="api-docs__section">

## Preview

</div><div class="api-docs__preview fn">

```ts
getSocketEvents<T>(eventEmitter)
```

</div><div class="api-docs__section">

## Parameters

</div><div class="api-docs__parameters"><table><thead><tr><th>Name</th><th>Details</th></tr></thead><tbody><tr param-data="eventEmitter"><td class="api-docs__param-name required">

### eventEmitter 

`Required`

</td><td class="api-docs__param-type">

`EventEmitter`

</td></tr></tbody></table></div><div class="api-docs__section">

## Returns

</div><div class="api-docs__returns">

```ts
{
  emitClose: () => void;
  emitConnecting: () => void;
  emitEmitterEvent: (emitter: EmitterType) => void;
  emitError: (event: ResponseType) => void;
  emitListenerEvent: (endpoint: string, __namedParameters: [object Object]) => void;
  emitListenerRemoveEvent: (endpoint: string) => void;
  emitOpen: () => void;
  emitReconnecting: (attempts: number) => void;
  emitReconnectingStop: (attempts: number) => void;
  onClose: (callback: () => void) => VoidFunction;
  onConnecting: (callback: () => void) => VoidFunction;
  onEmitterEvent: (callback: (emitter: EmitterType) => void) => VoidFunction;
  onEmitterEventByEndpoint: (emitter: EmitterType, callback: (emitter: EmitterType) => void) => VoidFunction;
  onError: (callback: (event: ResponseType) => void) => VoidFunction;
  onListenerEvent: (callback: (__namedParameters: [object Object]) => void) => VoidFunction;
  onListenerEventByEndpoint: (listener: ListenerType, callback: (__namedParameters: [object Object]) => void) => VoidFunction;
  onListenerRemove: (callback: (endpoint: string) => void) => VoidFunction;
  onListenerRemoveByEndpoint: (listener: ListenerType, callback: () => void) => VoidFunction;
  onOpen: (callback: () => void) => VoidFunction;
  onReconnecting: (callback: (attempts: number) => void) => VoidFunction;
  onReconnectingStop: (callback: (attempts: number) => void) => VoidFunction;
}
```

</div>